package com.knowif.pojo;

import java.util.Date;

import javax.validation.constraints.NotEmpty;

import org.springframework.validation.annotation.Validated;

import com.fasterxml.jackson.annotation.JsonFormat;

@Validated
public class Banner {
    private Integer id;

    /**
     * 跳转地址
     */
    @NotEmpty(message = "跳转链接不能为空")
    private String linkUrl;

    /**
     * 图片地址
     */
    @NotEmpty(message = "图片地址不能为空")
    private String picUrl;

    /**
     * 创建时间
     */
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getLinkUrl() {
        return linkUrl;
    }

    public void setLinkUrl(String linkUrl) {
        this.linkUrl = linkUrl == null ? null : linkUrl.trim();
    }

    public String getPicUrl() {
        return picUrl;
    }

    public void setPicUrl(String picUrl) {
        this.picUrl = picUrl == null ? null : picUrl.trim();
    }

    public Date getCreateTime() {
    	if(createTime == null){
    		createTime = new Date();
    	}
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

	@Override
	public String toString() {
		return "Banner [id=" + id + ", linkUrl=" + linkUrl + ", picUrl=" + picUrl + ", createTime=" + createTime + "]";
	}
    
    
}